package com.lanou.zhihu.web.controller;

import com.lanou.zhihu.entity.Topic;
import com.lanou.zhihu.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by QuChao on 2018/10/25.
 */
@Controller
@RequestMapping("/topic")
public class TopicController {
    @Autowired
    private TopicService topicService;

    @RequestMapping("/selectAll")
    @ResponseBody
    public Map<String, Object> selectAll() {
        Map<String, Object> map = new HashMap<>();
        List<Topic> topicList = topicService.selectAll();
        map.put("topicList", topicList);
        return map;
    }
}
